<?php
namespace Kuoqi\Api;
require_once(__DIR__.DIRECTORY_SEPARATOR.'qrcode-reader'.DIRECTORY_SEPARATOR.'qrlib.php');

use Kuoqi\Config;
use Zxing\QrReader;

/**
 * 二维码解析
 * Class QrcodeReader
 * @package Kuoqi\Api
 * User kuoqi
 * Datetime 2022/4/29 15:35
 * Remark
 */
class QrcodeReader extends \Kuoqi\Api{

    protected $file = '';
    protected $text = '';

    public function __construct($url = '')
    {
        $this->file = $url;
    }

    //解析
    public function exec(){
        $qrcode = new QrReader($this->file);
        $this->text = $qrcode->text();
    }

    //输出内容
    public function getText(){
        $this->exec();
        return $this->text;
    }

}